package com.qys.livesMall.finance.enums;

import com.qys.livesMall.common.message.QysLang;

import java.util.Objects;

/**
 * Created by IntelliJ IDEA.
 * User: dp
 * Date: 2023/05/16
 * Time: 14:26
 * DESCRIPTION: 异常枚举类
 */
public enum FinanceMessageEnum implements QysLang {
    USER_BALANCE_NOT_EXIST(50001,"user.balance.not.exist"),
    PLATFORM_BALANCE_NOT_EXIST(50002,"platform.balance.not.exist"),
    SHOP_BALANCE_NOT_EXIST(50003,"shop.balance.not.exist"),
    BUSINESS_TYPE_ERROR(50004,"business.type.error"),
    SHOP_BALANCE_BE_NOT_ENOUGH(50005,"shop.balance.not.enough"),
    USER_BALANCE_BE_NOT_ENOUGH(50006,"user.balance.not.enough"),

    ACCOUNT_BUSY(50007,"account.busy"),
    ACCOUNT_ERROR(50008,"account.error"),


    RE_AF(1,"re_af"),
    RE_DE(2,"re_de"),
    RE(3,"re"),
    RE_CL(4,"re_cl"),
    WL_AF(5,"wl_af"),
    WL_CL(6,"wl_cl"),
    WL(7,"wl"),
    SRE_AF(8,"sre_af"),
    SRE_DE(9,"sre_de"),
    SRE(10,"sre"),
    SRE_CL(11,"sre_cl"),
    SWL_AF(12,"swl_af"),
    SWL_CL(13,"swl_cl"),
    SWL(14,"swl"),
    GF(15,"gf"),
    DE(16,"de"),
    SGF(17,"sgf"),
    SDE(18,"sde"),
    PU(19,"pu"),
    RF(20,"rf"),
    YH(21,"yh"),
    YH_RB(22,"yh_rb"),
    YH_RA(23,"yh_ra"),
    YH_CT(24,"yh_ct"),
    YH_OP(25,"yh_op"),
    YH_SG(26,"yh_sg"),
    YH_AG(27,"yh_ag"),
    YH_PG(28,"yh_pg"),
    YH_SPF(29,"yh_spf"),
    YH_SP(30,"yh_sp"),
    GC(31,"gc"),
    PT(32,"pt"),
    PT_PO(33,"pt_po"),
    PT_PR(34,"pt_pr"),
    PT_PI(35,"pt_pi"),
    PT_SPI(36,"pt_spi"),
    LG_AG(37,"lg_ag"),
    FU(38,"fu"),
    FU_SG(39,"fu_sg"),
    SDP(40,"sdp"),
    IR(41,"ir"),
    LV_BS(42,"lv_bs"),
    LV_GG(43,"lv_gg"),
    VR(44,"vr"),
    SRE_RC(45,"sre_rc"),
    SRE_FRC(46,"sre_frc"),
    EM(47,"em"),
    REM(48,"rem"),
    PU_EM(49,"pu_em"),
    PU_REM(50,"pu_rem"),
    SUR(51,"sur"),
    SRR(52,"srr"),
    SIR(53,"sir"),
    CIB(54,"cib"),
    FB(55,"fb"),
    FLT(56,"flt"),
    EDRR(57,"edrr"),
    EMRB(58,"emrb"),
    WRTB(59,"wrtb"),
    ULUR(60,"ulur"),
    URFRC(61,"urfrc"),
    URR(62,"urr"),
    URRC(63,"urrc"),
    USOGRC(64,"usogrc"),
    ;


    private final String PROJECT="finance";

    /**
     * 错误码
     */
    private int code;

    /**
     * 错误描述
     */
    private String msgKey;

    FinanceMessageEnum(int code, String msgKey) {
        this.code = code;
        this.msgKey = msgKey;
    }

    public int getCode() {
        return code;
    }

    public String getMsgKey() {
        return msgKey;
    }

    @Override
    public String PROJECT() {
        return PROJECT;
    }

    public static FinanceMessageEnum getEnum(String key){
        for (FinanceMessageEnum financeMessageEnum:FinanceMessageEnum.values()){
            if (Objects.equals(financeMessageEnum.getMsgKey(),key)){
                return financeMessageEnum;
            }
        }
        return FinanceMessageEnum.BUSINESS_TYPE_ERROR;
    }


}
